<?php

class Zend_View_Helper_HasBlog {

    function hasBlog($user) {
        $db = Zend_Db_Table::getDefaultAdapter();
        $result = $db->fetchAll(
                        $db->select()
                        ->from(array('b' => 'blogs'),
                                array('user_id'))
                        ->join(array('u' => 'users'),
                                'b.user_id = u.id')
                        ->where('u.username = ?', $user)
        );
        return  (count($result) == 1 ? true : false);
    }
}